﻿using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace Sigma.Admin.Client.Converter
{
    [ValueConversion(typeof(int), typeof(PackIconKind))]
    public class PackIconKindConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value!=null&&value is int icon)
            {
                return (PackIconKind)icon;
            }else
                return PackIconKind.HelpCircleOutline;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value is PackIconKind icon)
            {
                return (int)icon;
            }
            return default(int);
        }
    }
}
